package com.esiag.isidis.fi.service;

import java.util.Observable;
import java.util.Observer;

import com.esiag.isidis.fi.pdsteam.entity.Message;
import com.esiag.isidis.fi.pdsteam.entity.RawByteObject;
import com.esiag.isidis.fi.pdsteam.entity.Sensor;

public class ObserverReceiver implements Observer {

	public void doWork(RawByteObject rawByteObject) {

		Coordinator coordinator = new Coordinator();
		Message message = coordinator.parse(rawByteObject, "pathFileConfig");
		Sensor sensor = coordinator.getSensor(message);
		coordinator.dispatche(message, sensor);
	}

	public void update(Observable o, Object object) {
		// TODO Auto-generated method stub
		RawByteObject rawByteObject = new RawByteObject((Byte[]) object);
		doWork(rawByteObject);
	}
}
